<meta name="csrf-token" content="{{ csrf_token() }}">
<style>
    #chart_container div {
        font-family: "微软雅黑";
        font-size: 25px;
    }

    textarea {
        overflow:hidden;
        font-size: 18px;
    }
</style>
<div id="page-wrapper">
    <script src="{{URL::asset('js/echarts.js')}}"></script>
    <script src="{{URL::asset('js/customed.js')}}"></script>
    <script src="{{URL::asset('js/jspdf.min.js')}}"></script>
    <script src="{{URL::asset('js/html2canvas.js')}}"></script>
    {{-- <script src="{{URL::asset('js/macarons.js')}}"></script>--}}
    <script type="text/javascript"></script>
</div>

<div class="box box-body" id="chart_container" style="">

</div>

<script type="text/javascript">
    $(document).ready(function(){
        var id = '{{$id}}';
        var request = {id:id};
        $.ajaxSetup({headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},async:false});
        $.post('/admin/squad_report/get',request,function(e){
            for(i in e){
                var html = '<div style="width:100%" id="parent_'+i+'"><div style="font-size:30px;width:100%">'+e[i].squad.name+'-学段：'+e[i].group.name+'</div></div>';
                $('#chart_container').append(html);

                html = '<div style="height:700px;width:100%;margin-top:40px" id="squad_'+i+'"></div>';
                $('#parent_'+i).append(html);

                var dom1 = document.getElementById('squad_'+i);
                var myChart1 = echarts.init(dom1);

                option = {
                    tooltip: {},
                    legend: {
                        data: ['班级', '学段'],
                        textStyle:{
                            fontWeight:'bolder',
                            fontSize:15
                        }
                    },
                    title: [{
                        text: '班级每月全勤率',
                        x: '14%',
                        textAlign: 'center'
                    }, {
                        text: '班级每月家校准交率',
                        y: '50%',
                        x: '15%',
                        textAlign: 'center'
                    },{
                        text: '学期全勤率平均值对比',
                        x: '80%',
                        textAlign: 'center'
                    },{
                        text: '学期家校准交率平均值对比',
                        y: '50%',
                        x: '80%',
                        textAlign: 'center'
                    }],
                    grid: [{
                        right:'40%',
                        bottom:'60%',
                        containLabel: true
                    }, {
                        left:'70%',
                        bottom:'60%',
                        containLabel: true
                    },{
                        right:'40%',
                        top:'60%',
                        containLabel: true
                    },{
                        left:'70%',
                        top:'60%',
                        containLabel: true
                    },],
                    xAxis: [{
                        type: 'category',
                        data: ['三月','四月','五月','六月'],
                        gridIndex:0,
                        axisLabel:{
                            textStyle:{
                                fontWeight:'bolder',
                                fontSize:15
                            }
                        }
                    },{
                        type: 'category',
                        gridIndex:1,
                    },
                        {
                            type: 'category',
                            data: ['三月','四月','五月','六月'],
                            gridIndex:2,
                            axisLabel:{
                                textStyle:{
                                    fontWeight:'bolder',
                                    fontSize:15
                                }
                            }
                        },{
                            type: 'category',
                            gridIndex:3
                        }],
                    yAxis: [{
                        type: 'value',
                        gridIndex:0,
                        boundaryGap: [0, 0.01]
                    },{
                        type: 'value',
                        gridIndex:1
                    },{
                        type: 'value',
                        gridIndex:2,
                        boundaryGap: [0, 0.01]
                    },{
                        type: 'value',
                        gridIndex:3
                    }],
                    series: [{
                        name: '班级',
                        type: 'bar',
                        data: e[i].squad.kaoqin.month,
                        xAxisIndex:0,
                        yAxisIndex:0,
                        label: {
                            normal: {
                                position: 'top',
                                show: true,
                                textStyle : {
                                    fontFamily : '微软雅黑',
                                    fontSize : 15,
                                    fontWeight : 'bolder'
                                }
                            }
                        },
                    },
                        {
                            name: '学段',
                            type: 'bar',
                            data: e[i].group.kaoqin.month,
                            xAxisIndex:0,
                            yAxisIndex:0,
                            label: {
                                normal: {
                                    position: 'top',
                                    show: true,
                                    textStyle : {
                                        fontFamily : '微软雅黑',
                                        fontSize : 15,
                                        fontWeight : 'bolder'
                                    }
                                }
                            },
                        }
                        ,{
                            name: '班级',
                            type: 'bar',
                            data: [e[i].squad.kaoqin.avg],
                            xAxisIndex:1,
                            yAxisIndex:1,
                            label: {
                                normal: {
                                    position: 'top',
                                    show: true,
                                    textStyle : {
                                        fontFamily : '微软雅黑',
                                        fontSize : 15,
                                        fontWeight : 'bolder'
                                    }
                                }
                            }
                        },
                        {
                            name: '学段',
                            type: 'bar',
                            data: [e[i].group.kaoqin.avg],
                            xAxisIndex:1,
                            yAxisIndex:1,
                            label: {
                                normal: {
                                    position: 'top',
                                    show: true,
                                    textStyle : {
                                        fontFamily : '微软雅黑',
                                        fontSize : 15,
                                        fontWeight : 'bolder'
                                    }
                                }
                            }
                        },{
                            name: '班级',
                            type: 'bar',
                            data: e[i].squad.jiaxiao.month,
                            xAxisIndex:2,
                            yAxisIndex:2,
                            label: {
                                normal: {
                                    position: 'top',
                                    show: true,
                                    textStyle : {
                                        fontFamily : '微软雅黑',
                                        fontSize : 15,
                                        fontWeight : 'bolder'
                                    }
                                }
                            },
                        },
                        {
                            name: '学段',
                            type: 'bar',
                            data: e[i].group.jiaxiao.month,
                            xAxisIndex:2,
                            yAxisIndex:2,
                            label: {
                                normal: {
                                    position: 'top',
                                    show: true,
                                    textStyle : {
                                        fontFamily : '微软雅黑',
                                        fontSize : 15,
                                        fontWeight : 'bolder'
                                    }
                                }
                            },
                        }
                        ,{
                            name: '班级',
                            type: 'bar',
                            data: [e[i].squad.jiaxiao.avg],
                            xAxisIndex:3,
                            yAxisIndex:3,
                            label: {
                                normal: {
                                    position: 'top',
                                    show: true,
                                    textStyle : {
                                        fontFamily : '微软雅黑',
                                        fontSize : 15,
                                        fontWeight : 'bolder'
                                    }
                                }
                            }
                        },
                        {
                            name: '学段',
                            type: 'bar',
                            data: [e[i].group.jiaxiao.avg],
                            xAxisIndex:3,
                            yAxisIndex:3,
                            label: {
                                normal: {
                                    position: 'top',
                                    show: true,
                                    textStyle : {
                                        fontFamily : '微软雅黑',
                                        fontSize : 15,
                                        fontWeight : 'bolder'
                                    }
                                }
                            }
                        }]
                }

                myChart1.setOption(option);
            }
        });
    });
</script>




